import { Findjob } from '../findjob/findjob-model.js';
var findjob = new Findjob(); //实例化 首页 对象
Page({

  /**
   * 页面的初始数据
   */
  data: {
    status:-1,
    page:1
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (e) {
    var that = this;

    wx.setNavigationBarTitle({
      title: '求职管理',
    })

    if (that.data.status >=-1) {
        var status = that.data.status;
      } else {
        var status = e.id;
        that.data.status = e.id;  
      }

    that.initpage();

  },

 initpage:function()
{
    var that = this;

    wx.setNavigationBarTitle({
      title: '求职管理',
    })


    var params = {status:that.data.status,page:that.data.page};

    findjob.myFindjob((data) => {

   
      that.setData({

        list:data.jobrecordlist
      });

      wx.hideNavigationBarLoading(); //完成停止加载
      wx.stopPullDownRefresh();


  },params);

},



  toSetComment: function (e) {
    var id = e.currentTarget.dataset.id;

      wx.navigateTo({
        url: "/pages/setcomment/index?id=" + id
      })
  

  },

  toJob: function (e) {
    var pid = e.currentTarget.dataset.id;

      wx.navigateTo({
        url: "/pages/jobdetail/index?id=" + pid
      })
  

  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    wx.showNavigationBarLoading();
    this.initpage();
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

    var that = this;
  
    this.data.page = this.data.page+1;
    that.initpage();


  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
 var that = this;
    return {
        title:'求职管理' ,
        path: '/pages/myfind/index'
    }
  }
})